#统计字母出现次数
n=int(input())
l=[0]*n
now=0
for i in range(1,1000):
    l[now]=1
    now+=i+1
    now%=n
flag=0
for i in range(n):
    if l[i]==0:
        print(i+1)
        flag=1
if flag==0:
    print(0)